import {defineAsyncComponent} from "vue";

const modules = import.meta.glob("./*/*.vue")

export default {

    install (app:any) {
        for (const path in modules) {
            const result = path.match(/.*\/(.+)\/index.vue$/);
            if (result) {
                const name = result[1];
                const component:any = modules[path];
                app.component(name, defineAsyncComponent(component));
            }
        }
    }
}